home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume6 / xchess-hpux / patch1 next >
Encoding:
Internet Message Format  |  1990-02-27  |  7.8 KB

  1. Path: uunet!cs.utexas.edu!sun-barr!newstop!sun!turnpike!argv
  2. From: argv%turnpike@Sun.COM (Dan Heller)
  3. Newsgroups: comp.sources.x
  4. Subject: v06i006: xchess under HP-UX diffs, Patch1
  5. Message-ID: <132320@sun.Eng.Sun.COM>
  6. Date: 28 Feb 90 09:52:51 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 353
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: Konstantinos Konstantinides <uunet!hpkronos.hp.com!kk>
  12. Posting-number: Volume 6, Issue 6
  13. Archive-name: xchess-hpux/patch1
  14.  
  15. This file contains the differences so that xchess runs under HP-UX
  16. K. Konstantinides
  17. kk@hpkronos.hpl.hp.com
  18.  
  19. --------------------------
  20. # This is a shell archive.  Remove anything before this line,
  21. # then unpack it by saving it in a file and typing "sh file".
  22. #
  23. # Wrapped by Konstantinos Konstantinides <kk@hpkronos> on Fri Jan  5 10:12:40 1990
  24. #
  25. # This archive contains:
  26. #    READ_HPUX    Makefile.hpux    chess_dif    
  27. #
  28.  
  29. LANG=""; export LANG
  30. PATH=/bin:/usr/bin:$PATH; export PATH
  31.  
  32. echo x - READ_HPUX
  33. cat >READ_HPUX <<'@EOF'
  34. Revision: Nov. 8, 1989
  35. This is chess for the X11 window system
  36.  
  37. Since HP doesn't have the chesstool program, a small modification
  38. in the code of gnuchess.c permits gnuchess to be used with the xchess program.
  39. A new flag (-l level) in xchess permits the user to specify the search level
  40. time limit (default is 30 sec).
  41. After compiling gnuchess (make) and xchess (make -f Makefile.hpux in
  42. the Xchess directory) , a typical command will be
  43.  
  44. xchess -i -c -p /usr/local/games/gnuchessr -l 20
  45.  
  46. This uses the english notation, to play with the computer, a game
  47. of gnuchess, at a level of 20 sec (max) per move.
  48.  
  49. Another typical command will be
  50.  
  51. xchess -i -c -p /usr/local/games/gnuchessr -t 20 5
  52.  
  53. This requires from gnuchessr to play the first 20 moves in 5 minutes
  54.  
  55. Other options in xchess
  56.  -f : recordfile
  57.  -r : saved file
  58.  
  59. Of course you can play gnuchess with no xwindows (see the man page of
  60. gnuchess)
  61. -------------------------------------------------------
  62. Revision: Sept. 26/89
  63.  
  64. Fixed the noisy-flag and the flash-flag problems.
  65.  
  66. For example, my .X11defaults now has
  67. /*
  68.  *xchess
  69.  */
  70. xchess*savemoves:       on
  71. xchess*algebraic:       on
  72. xchess*flash:           on
  73. xchess*numflashes:      5
  74. xchess*noisy:           on
  75. xchess*progname:        /usr/local/games/gnuchessr
  76.  
  77. Then I play with: xchess -c -l 10
  78.  
  79. K. Konstantinides kk@hpkronos
  80. @EOF
  81.  
  82. chmod 600 READ_HPUX
  83.  
  84. echo x - Makefile.hpux
  85. cat >Makefile.hpux <<'@EOF'
  86.  
  87. # RCS Info: $Revision: 1.5 $ on $Date: 86/11/26 12:09:19 $
  88. #           $Source: /users/faustus/xchess/RCS/Makefile,v $
  89. # Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
  90. #
  91. # Makefile for xchess.
  92.  
  93. CC = cc -O
  94.  
  95. CFILES    =\
  96.     board.c\
  97.     button.c\
  98.     clock.c\
  99.     control.c\
  100.     jail.c\
  101.     message.c\
  102.     parse.c\
  103.     popup.c\
  104.     program.c\
  105.     record.c\
  106.     std.c\
  107.     valid.c\
  108.     window.c\
  109.     XCircle.c
  110.  
  111. COBJS    =\
  112.     board.o\
  113.     button.o\
  114.     clock.o\
  115.     control.o\
  116.     jail.o\
  117.     message.o\
  118.     parse.o\
  119.     popup.o\
  120.     program.o\
  121.     record.o\
  122.     std.o\
  123.     valid.o\
  124.     window.o\
  125.     XCircle.o
  126.  
  127. HFILES    =\
  128.     std.h\
  129.     xchess.h
  130.  
  131. SOURCE = $(CFILES)
  132.  
  133. ALLFILES = $(SOURCE) $(HFILES)
  134. #DESTDIR = /global
  135. DESTDIR = /usr/local/games
  136. #INCLUDE = -I. -I$(DESTDIR)/include
  137. INCLUDE = -I.
  138.  
  139. #DEFINES = -DDEF_PROGRAM=\"$(DESTDIR)/bin/gnuchessr\"
  140. DEFINES = -DDEF_PROGRAM=\"$(DESTDIR)/gnuchessr\"
  141.  
  142. CFLAGS = $(DEFINES) $(INCLUDE) 
  143. LINTFLAGS = -u -z -lc -DLINT $(DEFINES) $(INCLUDE)
  144. LINTLIB = ../lib/llib-lX.ln
  145. #LDFLAGS = -L$(DESTDIR)/lib -z -loldX -lX11 -lm
  146. LDFLAGS = -loldX -lXw -lXt -lXext -lX11 -lm -lBSD
  147. GPLDFLAGS = -z -lXMenu_p -lX -lm_p -g -pg
  148.  
  149. .c.o: $*.c
  150.     $(CC) $(CFLAGS) -c $*.c +Nd2000 +Ns2000 +Ne1000
  151. .s.o: $*.s
  152.     $(CC) $(CFLAGS) -c $*.s
  153.  
  154. all: xchess scrollText.o
  155.     @echo "All done."
  156.  
  157. everything: all tags depend lint wc
  158.     @echo "All done."
  159.  
  160. xchess:    xchess.o $(COBJS) scrollText.o
  161.     $(CC) -o xchess xchess.o $(COBJS) scrollText.o \
  162.     $(LDFLAGS)
  163.  
  164. scrollText.o: scrollText.h scrollText.c
  165.  
  166. gpxchess: xchess.o $(COBJS)
  167.     $(CC) -o gpxchess xchess.o $(COBJS) scrollText/libScroll.a \
  168.     $(GPLDFLAGS)
  169.  
  170. lint:    $(SOURCE)
  171.     lint $(LINTFLAGS) $(SOURCE) $(LINTLIB) | \
  172.     grep -v "multiply declared"
  173.  
  174. qgrind: $(ALLFILES)
  175.     qgrind -lc $(ALLFILES)
  176.  
  177. vgrind:    $(ALLFILES)
  178.     vgrind -lc $(ALLFILES)
  179.  
  180. opt: all
  181.  
  182. reopt: all
  183.  
  184. install: all
  185.  
  186. source:    $(SOURCE) 
  187.  
  188. tags: $(ALLFILES)
  189.     ctags -w -t *.c *.h > /dev/null 2>&1
  190.  
  191. wc: $(ALLFILES)
  192.     @wc $(ALLFILES)
  193.  
  194. print: $(ALLFILES)
  195.     @pr $(ALLFILES)
  196.  
  197. clean:
  198.     rm -f *.o *.a *.out xchess tags foo tmp
  199.  
  200. tar:
  201.     tar -cvf xchess.tar Makefile *.h *.c *.bitmap *.icon *.cur *.1\
  202.     scrollText/Makefile scrollText/*.h scrollText/*.c scrollText/*.1\
  203.     scrollText/*.3
  204.  
  205. $(ALLFILES):
  206.     co $@
  207.  
  208. depend: $(SOURCE)
  209.     cc -M $(CFLAGS) $(CFILES) > makedep
  210.     echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
  211.     echo '$$r makedep' >>eddep
  212.     echo 'w' >>eddep
  213.     ed - Makefile < eddep
  214.     rm eddep makedep 
  215.     echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
  216.     echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
  217.     echo '# see make depend above' >> Makefile
  218.  
  219. #-----------------------------------------------------------------
  220. # DO NOT DELETE THIS LINE -- make depend uses it
  221. # DEPENDENCIES MUST END AT END OF FILE
  222.  
  223. xchess.o $(COBJS): $(HFILES)
  224.  
  225. @EOF
  226.  
  227. chmod 644 Makefile.hpux
  228.  
  229. echo x - chess_dif
  230. cat >chess_dif <<'@EOF'
  231. ---control.c
  232. 131c131
  233. <         message_add(win, "Hey, you touch it, you move it, buddy.\n",
  234. ---
  235. >         message_add(win, "Hey, you move it now, buddy.\n",
  236. 237a238
  237. >         if(win2->display != 0)
  238. ---program.c
  239. 1d0
  240. 33a33,35
  241. > #ifdef hpux
  242. > #include <time.h>
  243. > #else
  244. 34a37
  245. > #endif
  246. 42,43c45,46
  247. < program_init(name)
  248. <     char *name;
  249. ---
  250. > program_init(name,level)
  251. >     char *name, *level;
  252. 48a52
  253. >     extern int flag;
  254. 64,65c68,69
  255. <             execl("/usr/ucb/rsh", "rsh", proghost, name,
  256. <                     moves, time, 
  257. ---
  258. >             execl("/usr/ucb/rsh", "remsh", proghost, name,level,
  259. >             /*        moves, time,  */
  260. 68c72,80
  261. <             execl(name, name, moves, time, (char *) NULL);
  262. ---
  263. >         switch (flag) {
  264. >         case 0 :execl(name, name, (char *) NULL);
  265. >             break;
  266. >         case 1 :execl(name, name, level, (char *) NULL);
  267. >             break;
  268. >         case 2 :execl(name, name, moves, time, (char *) NULL);
  269. >             break;
  270. >         default:execl(name, name, (char *) NULL);
  271. >             }
  272. ---std.c
  273. 1d0
  274. 247a247,253
  275. > #ifdef  hpux
  276. > #define index   strchr
  277. > #define rindex  strrchr
  278. > #define bcopy(a,b,c)    memcpy(b,a,c)
  279. > #define bzero(a,b)      memset(a,0,b)
  280. > #endif
  281. ---std.h
  282. 1d0
  283. 31a31,33
  284. > #ifdef hpux
  285. > #undef BSD
  286. > #endif
  287. 41a44,46
  288. > #ifdef  hpux
  289. > #include <string.h>
  290. > #else
  291. 42a48
  292. > #endif
  293. ---window.c
  294. 414c414
  295. <         0, LineSolid, 0, 0);
  296. ---
  297. >         flash_size, LineSolid, 0, 0);
  298. ---xchess.c
  299. 1d0
  300. 24c23
  301. <  *           $Source: /usr/local/src/source/X.V11R3/contrib/games/xchess/Xchess/RCS/xchess.c,v $
  302. ---
  303. >  *           $Source: /usr/local/src/source/X.V11R3/contrib/games/xchess/Xchess/ RCS/xchess.c,v $
  304. 26,27c25,26
  305. <  *    Permission is granted to do anything with this code except sell it
  306. <  *    or remove this message.
  307. ---
  308. >  *      Permission is granted to do anything with this code except sell it
  309. >  *      or remove this message.
  310. 31,32c30,31
  311. < \t[ -t moves/timeunit ] [ -c ] [ -p program ]  [ -b ] [ -bnw ] [ -s ]\n\
  312. < \t[ -n ] [ -h host ] [ -v ] [ -R ] [ whitedisplay ] [ blackdisplay ]"
  313. ---
  314. > \t[ -t moves timelimit(min) ] [ -c ] [ -p program ]  [ -b ] [ -bnw ] [ -s ]\n\
  315. > \t[ -n ] [ -h host ] [ -v ] [ -R ] [ whitedisplay ] [ blackdisplay ] [-l level]"
  316. 44a44,45
  317. > char *level;
  318. > int flag=0;
  319. 87c88
  320. <     signal(SIGCHLD, die);
  321. ---
  322. >     signal(SIGCHLD, die); 
  323. 117a119
  324. >                 flag = 2;
  325. 119,120c121,123
  326. <                 if (s = index(*av, '/'))
  327. <                     timeunit = atoi(s + 1) * 60;
  328. ---
  329. >                 av++; ac--;
  330. >                 if (*av)
  331. >                     timeunit = atoi(*av) * 60;
  332. 130a134,142
  333. >         } else if (eq(*av, "-l")) {
  334. >             av++; ac --;
  335. >             if (*av)
  336. >                 {
  337. >                 level = *av;
  338. >                 flag =1;
  339. >                 }
  340. >             else
  341. >                 goto usage;
  342. 182c194
  343. <         if (!program_init(progname))
  344. ---
  345. >         if (!program_init(progname,level))
  346. @EOF
  347.  
  348. chmod 644 chess_dif
  349.  
  350. exit 0
  351.  
  352. dan
  353. -----------------------------------------------------------
  354.             O'Reilly && Associates
  355.         argv@sun.com / argv@ora.com
  356.        632 Petaluma Ave, Sebastopol, CA 95472 
  357.      800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
  358.     Opinions expressed reflect those of the author only.
  359.